<extend name="Public/base"/>


<block name="body">
	<!-- 标题 -->
	<div class="main-title">
		<h2>用户返利申请处理</h2>
	</div>

    <p>
        用户提交的订单号: {$apply.orders}
    </p>
    
    <h2>匹配到的联盟返利订单信息:</h2>
	<!-- 数据表格 -->
    <div class="data-table">
		<table>
            <!-- 表头 -->
            <thead>
                <tr>
                    <th class="row-selected row-selected">
                        <input class="check-all" type="checkbox">
                    </th>
                    <th>#</th>
                    <th>订单编号</th>
                    <th>创建时间</th>
                    <th>订单状态</th>
                    <th>付款金额</th>
                    <th>结算时间</th>
                    <th>佣金金额</th>
                    <th>补贴金额</th>
                    <th>返利状态</th>
                </tr>
            </thead>

            <!-- 列表 -->
            <tbody>
                <notempty name="orders">
                <volist name="orders" id="data">
                    <tr>
                        <td><if condition="$data.isWithdrawal eq 0"><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></if></td>
                        <td>{$data.id}</td>
                        <td>{$data.oid}</td>
                        <td>{$data.createTime}</td>
                        <td>{$data.status}</td>
                        <td>{$data.amount}</td>
                        <td>{$data.dealTime}</td>
                        <td>{$data.commissionAmount}</td>
                        <td>{$data.subsidyAmount}</td>
                        <td>{$data.isWithdrawal|yon_title}</td>
                    </tr>
                </volist>
                <else/>
                <td colspan="8" class="text-center"> aOh! 暂时还没有内容! </td>
                </notempty>
            </tbody>
        </table>
    </div>
    <notempty name="orders">
    <if condition="$apply.status eq 'WAITING'">
            <button class="btn ajax-post" url="{:U('Order/apply_approve', array('id'=>$apply.id))}&id={$apply.id}" target-form="ids">审核通过</button>
            
            <button class="btn ajax-get" url="{:U('Order/apply_reject')}&id={$apply.id}">审核不通过</button>
    </if>
    </notempty>
    
</div>

</block>
<block name="script">
<script type="text/javascript">
    $(function(){
        //搜索功能
        $("#search").click(function(){
            var url = $(this).attr('url');
            var status = $("#sch-sort-txt").attr("data");
            var query  = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            if(status != ''){
                query += 'status=' + status + "&" + query;
            }
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            window.location.href = url;
        });
    
        /* 状态搜索子菜单 */
        $(".search-form").find(".drop-down").hover(function(){
            $("#sub-sch-menu").removeClass("hidden");
        },function(){
            $("#sub-sch-menu").addClass("hidden");
        });
        $("#sub-sch-menu li").find("a").each(function(){
            $(this).click(function(){
                var text = $(this).text();
                $("#sch-sort-txt").text(text).attr("data",$(this).attr("value"));
                $("#sub-sch-menu").addClass("hidden");
            })
        });
    
        //回车自动提交
        $('.search-form').find('input').keyup(function(event){
            if(event.keyCode===13){
                $("#search").click();
            }
        });
        
    })
</script>
            
</block>
